{	Problem: http://codeforces.ru/problemset/problem/38/B
	Verdict: Accepted

}
var s:string; i,j,x1,y1,x2,y2,c:longint;
begin
readln(s);
x1:=ord(s[1])-ord('a')+1;
y1:=ord(s[2])-48;
readln(s);
x2:=ord(s[1])-ord('a')+1;
y2:=ord(s[2])-48;
c:=0;
for i:=1 to 8 do
  for j:=1 to 8 do
    if (i=x1) or (j=y1) or ((abs(i-x2)=2) and (abs(j-y2)=1)) or ((abs(i-x2)=1) and (abs(j-y2)=2)) or ((abs(i-x1)=2) and (abs(j-y1)=1)) or ((abs(i-x1)=1) and (abs(j-y1)=2)) or ((i=x1) and (j=x1)) or ((i=x2) and (j=y2)) then else inc(c);
writeln(c);
end.